from openpyxl import load_workbook
import os

def readexcel(filename, sheetname):
    path = os.path.join(filename)

    wb = load_workbook(path)

    #指定sheet
    sheetobj = wb[sheetname]

    #获取最大行
    maxrow = sheetobj.max_row

    #获取最大列
    maxcol = sheetobj.max_column

    #定义列表用例存储当前sheet中所有你内容
    list_text = []

    for row in range(2, maxrow+1):

        #定义一个列表用来保存，每一行的取值
        row_list = []

        for col in range(1,maxcol+1):
            text = sheetobj.cell(row,col).value
            row_list.append(text)

        list_text.append(row_list)

    return list_text

if __name__ == '__main__':
    r = readexcel("../data/shareparking.xlsx", "公告")
    print(r)